package com.codingclub.common.exception;

import com.codingclub.common.enums.ErrCode;

public class BusinessException extends RuntimeException{
    private final int code;//这里用了 int 而不是Integer

    BusinessException(int code,String message){
        //先调用supper
        super(message);
        this.code=code;
    }

    public BusinessException(ErrCode errCode){
        super(errCode.getMessage());
        this.code=errCode.getCode();
    }

    public BusinessException(ErrCode errCode,String message){
        super(message);
        this.code=errCode.getCode();
    }

    public int getCode() {
        return code;
    }
}
